$root = get-item $args[0] 
$dirname = $root.Name.ToString()

$guid = [System.Guid]::NewGuid().ToString()
$idbase = $guid.replace("{","")
$idbase = $idbase.replace("}","")
$idbase = $idbase.replace("-","")

$hadFiles = $False

"<Directory Id='D$idbase' Name='$dirname'>"

foreach ($f in dir $args[0] )
{
	if (!$f.PSIsContainer)
	{		
		$fguid = [System.Guid]::NewGuid().ToString()
		$fguid = $fguid.replace("{","")
		$fguid = $fguid.replace("}","")
		$fguid = $fguid.replace("-","")
		"<Component Id='C_$fguid' Guid='" + [System.Guid]::NewGuid().ToString() + "'>"
			"<File Id='F_$fguid' Name='$f' DiskId='1' Source='" + $f.FullName + "' Vital='yes'/>" 
		"</Component>"
	}
}
foreach ($f in dir $args[0])
{
	if ($f.PSIsContainer)
	{
		.\Tasks\buildWixDirectories.ps1 $f.FullName		
	}
}
"</Directory>"
